// ==UserScript==
// @name          Glitch Location Checker
// @namespace     http://beta.glitch.com/profiles/PCRVAH9D41N1IGA/
// @namespace     http://beta.glitch.com/profiles/PCR3S8COLJL1ILC/
// @description   Adds more locations, and crosses off locations you've already visited. Hosted at http://bit.ly/glochelper. Do you want to help?
// @match         http://www.glitch.com/locations/
// @match         http://www.glitch.com/locations/?*
// @include       http://www.glitch.com/locations/
// @include       http://www.glitch.com/locations/?*
// ==/UserScript==

if (document.location.search.substring(1).split('&').indexOf("norun=1") > -1) {
	return; 	// abort and show original page
}

// Enable this to add a few non-essential tools that I use to maintain the list.
var DEBUG = (document.location.search.substring(1).split('&').indexOf("debug=1") > -1);
var script;

var BASE_URL = 'http://glitch-location-checker.googlecode.com/svn/';
var LISTING_SCRIPT = 'trunk/hosted/location_listing.js';
var PROCESSING_SCRIPT = 'branches/api_only/hosted/location_processor.js';

script = document.createElement('script');
script.setAttribute("type", "text/javascript");
script.innerHTML = ''
	+ 'var DEBUG = ' + DEBUG + ';'
	+ 'var LISTING_SCRIPT = "' + BASE_URL + LISTING_SCRIPT + '";';
(document.body || document.head || document.documentElement).appendChild(script);

script = document.createElement('script');
script.setAttribute("src", BASE_URL + PROCESSING_SCRIPT);
script.setAttribute("type", "text/javascript");
(document.body || document.head || document.documentElement).appendChild(script);
